﻿<%@ Page Language="C#" MasterPageFile="~/aspnet/admin/ForValidation.master" AutoEventWireup="true" CodeFile="CX_News_Show.aspx.cs" Inherits="aspnet_admin_bock_News_CX_News_Show" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <!--   <style type="text/css">
    a:visited {
	    color: #004F4F;
    }
    </style>
    -->
<table align="center" border="0" cellpadding="2" cellspacing="1" class="border"
        height="116" width="100%">
        <tr align="center">
            <td class="topbg" colspan="2" style="height: 28px">
                搜索新闻</td>
        </tr>
        <tr>
            <td class="tdbg" colspan="2" style="height: 27px">
                提示信息:<asp:Label ID="tt" runat="server" CssClass="font-4"></asp:Label></td>
        </tr>
        <tr>
            <td class="tdbg" style="height: 27px" width="223">
                新闻标题名称:</td>
            <td class="tdbg" style="width: 787px; height: 27px">
                <asp:TextBox ID="CX_NEWS_Name" runat="server" MaxLength="50" Width="396px"></asp:TextBox>
                &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;
            </td>
        </tr>
        <tr>
            <td class="tdbg" colspan="2" style="height: 27px">
                <center>
                    <input id="Button1" class="btn" type="button" onclick="GetGamesData('r',escape(document.getElementById('<%=CX_NEWS_Name.ClientID %>').value),'0'); loand('r',escape(document.getElementById('<%=CX_NEWS_Name.ClientID %>').value)); ;document.getElementById(page_contid).innerHTML='<div style=\'text-align:center;\'><img src=\'/aspnet/admin/images/loading.gif\'>搜索时数据量较大，请耐心等待<br/>如果长时间没响应请更换关键字后再进行搜索<br/>正在搜索...</div>';" value="搜索" /></center>
            </td>
        </tr>
    </table>
    <br />
    <div ></div>
    <div style="float:left; width:77%;">
    <div class="title"  style="text-align:right;">操作: 
        <input id="Button2" class="box" type="button"  onclick="javascript:UseBox.SelectAll全选复选框('Panel');" value="全选" /> &nbsp;&nbsp;&nbsp;&nbsp; 
        <input id="Button3" type="button"  onclick="javascript:UseBox.SelectAllRe取消选复选框('Panel');" class="box" value="取消全选" />&nbsp;&nbsp;&nbsp;&nbsp; 
        <input id="Button4" type="button"  class="box" onclick="delc(UseBox.SelectValue('Panel'));" value="删除所选" />&nbsp;&nbsp;&nbsp;&nbsp; 
    </div>
    <div id="Panel">
        <h3>请点击右边的菜单显示新闻</h1></div>
         <div id="Pagelist" style="text-align:center;"></div>
    </div>
    <div style="float:left; width:12%;">
            <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1" 
            ShowLines="True" ExpandDepth="1">
            <DataBindings>
                <asp:treenodebinding DataMember="一级分类菜单" NavigateUrlField="Event" 
                    TextField="分类菜单名" />
            </DataBindings>
        </asp:TreeView>
        <asp:XmlDataSource ID="XmlDataSource1" runat="server"  DataFile="~/aspnet/admin/Menu/Menu_Data/TreeView_DataSource.xml"></asp:XmlDataSource>
    </div>
    

    <div style="clear:both;"></div>
    
    <asp:Label ID="Label3" runat="server"></asp:Label>

    <script src="../../../../aspnet/admin/inc/js/ajaxrequest.js" type="text/javascript"></script>
<script type="text/javascript">
/*
//made : skybot
//date : 2008-1-3
//website: http://www.qlili.com/*/
var _totalItem =0;//总记录数
var ChangePage ="changePage";//分页的函数
var _status = 'k';//类型
var _startPage = 1;//开始页面
var _itemPerPage = 500; //每页显示数
var _curPage = 0;//当前页
var _parent ='0';
var page_contid="Panel";//分页内容的ID

function loand(txxType,txxClass)
{/// <summary>
/// 传入 游戏的类型ID  问题的类别 返回的LIST
/// </summary>
/// <param name="txxType">读取问题类型</param>
/// <param name="txxClass">问题的分类类别</param>
///Exam: GetGamesData('n','6','1');

    GetGamesData(txxType,txxClass,'1');
    _curPage =0;//当前页为0
     _parent = txxClass;//分类
    _status=txxType; //类型
    page_contid="Panel";//装分页内容的ID
    document.getElementById("Pagelist").innerHTML="";
}
function GetGamesData(pp,ss,page)
{/// <summary>
/// 传入 类型ID  问题的类别 返回的LIST
/// </summary>
/// <param name="pp">类型</param>
/// <param name="ss">类别</param>
/// <param name="page">当前页</param>
/// <returns></returns>
    var GamesAjaxDataValue = new AJAXRequest(); 
    GamesAjaxDataValue.get('NewsListDataSource.aspx?Type='+pp+'&status='+ss+"&page="+page,GameData);
    
}

function GameData(obj)
{
   var xmlobj = obj.responseText;
    try
    {
            var tab =xmlobj;
            document.getElementById(page_contid).innerHTML = obj.responseText;
             
    }
    catch(e)
    {
        //alert(e);
    }
    
    eval(obj.responseXML.getElementsByTagName("Xzone").item(0).firstChild.data); //执行 setAskTotal
    
}

function setAskTotal(total)
{
	createPageList(document.getElementById('Pagelist'), _startPage,  total, _itemPerPage,_curPage, ChangePage);
}

///分页得到数据的函数
function changePage(_pg, status, parent)
{

try
{
	_curPage = _pg || 1;
	_status = (status == "" || typeof status == "undefined") ? _status : status;
	_parent = (parent == ""  || typeof parent == "undefined") ? _parent : parent;
	//_startPage=_pg || 1;
	_startPage= 1;//当前页面 开始页面
	
}
catch(e)
{
    alert(e);
}
    document.getElementById(page_contid).innerHTML="<div style=\"text-align:center;\"><img src='/aspnet/admin/images/loading.gif'>正在搜索...</div>";
	GetGamesData(_status,_parent , _curPage);//得到数据
	createPageList(document.getElementById('Pagelist'), _startPage, _totalItem, _itemPerPage,_curPage, ChangePage);
	return ;
}

//_con 对像 div
//_startPg 开始分页的页面
// _totalItem //总记录
// _itemPerPg //每页显示数
/// _curPg// 当前页 第几页 
/// _act// 要写入执行得到数据的函数
function createPageList(_con, _startPg, _totalItem, PageSize, _curPg,  _act)
{
var str = '';
try
{	
    if (_curPg == 0) _curPg = 1;

	var _pgCount = Math.ceil(_totalItem/PageSize);
	_pgCount = _pgCount || 1;
	////
	
	str += '共'+ (_pgCount-1) +'页';
	str += '&nbsp;&nbsp;|&nbsp;&nbsp;';
	if (_curPg == _startPg)
	 {
	 	str += '&nbsp;当前第 '+_curPg+' 页&nbsp;|&nbsp;';
		str += '第一页';
		str += '&nbsp;';
		str += '上一页';
	}
	else 
	{
	
	 	str += '&nbsp;当前第 '+_curPg+' 页&nbsp;|&nbsp;';
		str += '<a href="#"  onclick="'+_act+'('+_startPg+');return false;">第一页</a>';
		str += '&nbsp;';
		str += '<a href="#" onclick="'+_act+'('+(_curPg-1)+');return false;">上一页</a>';
	}
	
		str += '&nbsp;';
	for (var i=_startPg; i<=_pgCount; i++) {
		if (i == _curPg) {
			str += i;
			str += '&nbsp;';
		}
		else if (i>=_curPg-5 && i<=_curPg+5) {
			str += '<a href="#" onclick="'+_act+'('+i+');return false;">'+i+'</a>';
			str += '&nbsp;';
		}
		else if (i == _curPg-6 || i == _curPg+6) {
			str += '...&nbsp;';
		}
	}
	if (_curPg == _pgCount) {
		str += '下一页';
		str += '&nbsp;';
		str += '最末页';
	}
	else
	{
		str += '<a href="#" onclick="'+_act+'('+(_curPg+1)+');return false;">下一页</a>';
		str += '&nbsp;';
		str += '<a href="#" onclick="'+_act+'('+(_pgCount-1)+');return false;">最末页</a>';
	}
 }
 catch(e)
 {
    _con.innerHTML += "<br/>页面 较少";
 }
 _con.innerHTML ="<br/>&nbsp;&nbsp;&nbsp;&nbsp;"+str; //写入str
}
</script>
<script type="text/javascript">
function cu(objid)
{
    var newsclassid=objid
    document.getElementById(page_contid).innerHTML="<div style=\"text-align:center;\"><img src='/aspnet/admin/images/loading.gif'>正在加载数据...</div>";
    loand('n',newsclassid); 
}

function delc(ids)
{
    if(ids!="")
    {
        var urls ="DelNews.ashx?id="+ids+"&page="+_curPage+"&status="+_parent+"&flag=delete"+"&Type="+_status;
       var ajax = new AJAXRequest();
       
       if(confirm("您确定要删除吗?"))
       {
           ajax.get(urls,function(obj){eval(obj.responseText)});
       }
    
    }
}
</script>
<script type="text/javascript">
/*
//made : skybot
//date : 2007-11-16
//website: http://www.qlili.com/*/
function Checkbox()
{/// <summary>
/// 复选框前台操作类型
/// </summary>
   this.SelectAll全选复选框=function(obj)
   {
   /// <summary>
    /// 传入一个对象的ID 把这个对象ID 下的所有 textbox 全选
    /// </summary>
    ///得到的值
     var values ="";
     var Sleobjs =    this.GetElementCollection("input");
     for(i=0;i<Sleobjs.length;i++)
     {
        if(Sleobjs[i].type=="checkbox")
        {
            Sleobjs[i].checked=true;
            if(Sleobjs[i].value.replace(" ","")!=""&&Sleobjs[i].value.replace(" ","")!="on")
            {
                values=values+Sleobjs[i].value.replace(" ","")+",";
            }
        }
        
     } 
     return this.SubStr(values);
    }
    
    this.SelectValue= function(obj)
    {
           /// <summary>
    /// 传入一个对象的ID 把这个对象ID 下的所有 textbox 全选
    /// </summary>
    ///得到的值
     var values ="";
     var Sleobjs =    this.GetElementCollection("input");
     for(i=0;i<Sleobjs.length;i++)
     {
        if(Sleobjs[i].type=="checkbox")
        {
            if(Sleobjs[i].checked==true)
            {
                if(Sleobjs[i].value.replace(" ","")!=""&&Sleobjs[i].value.replace(" ","")!="on")
                {
                    values=values+Sleobjs[i].value.replace(" ","")+",";
                }
            }
        }
        
     } 
     return this.SubStr(values);
    }
    
   this.SelectAllRe取消选复选框=function(obj)
   {
    /// <summary>
    /// 传入一个对象的ID 把这个对象ID 下的所有 textbox 取消全选
    /// </summary>
     //得到的值
     var values ="";
     var Sleobjs =    this.GetElementCollection("input");
     for(i=0;i<Sleobjs.length;i++)
     {
        if(Sleobjs[i].type=="checkbox")
        {
            Sleobjs[i].checked=false;
            if(Sleobjs[i].value.replace(" ","")!="")
            {
                values+=Sleobjs[i].value.replace(" ","")+",";
            }
        }
       
      }
     return this.SubStr(values);
        
   }
    
   this.Select=function(obj)
   {
    /// <summary>
    /// 传入一个对象的 id 把这个对象 下的所有指定的 textboex 选中的 
    ///调用方法 Select("obj id")
    /// </summary>
    ///得到的值
     var values ="";
     var Sleobjs =    this.GetElementCollection("input");
     for(i=0;i<Sleobjs.length;i++)
     {
        if(Sleobjs[i].type=="checkbox"&&Sleobjs[i].checked==true)
        {
            if(Sleobjs[i].value.replace(" ","")!="")
            {
                values+=Sleobjs[i].value.replace(" ","")+",";
            }
        }
       
      }
     return this.SubStr(values);
   }
   
   
   this.GetElementCollection=function(obj)
   {/// <summary>
    /// 传入一个对象的 id 把这个对象 下的所有指定的 TageName做为一个对象返回
    ///调用方法 this.GetElementCollection("li")
    /// </summary>
        return document.getElementsByTagName(obj);
   }
   
   
   this.SubStr=function(str)
   {/// <summary>
    /// 传入一个字符串 把字符串后面的最后一个字符去掉  一般用于处理ID 
    ///调用方法 this.GetElementCollection("li")
    /// </summary>
    
        if(str.indexOf(",")!=-1)
        {
            return str.substring(0,str.length-1);
        }
        else
        {
            return "";
        }
        
   }
    
}
var UseBox =new Checkbox();
</script>
</asp:Content>


